package com.wanmait.demo.webcontroller.usercontroller.personalController;

import com.wanmait.demo.pojo.OrderComment;
import com.wanmait.demo.service.OrderCommentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("user/personalCenter/order")
public class commentController {

    @Resource
    private OrderCommentService orderCommentService;
    @RequestMapping("/commentCommit")
    public String  writeComment(OrderComment orderComment){

        try {
            orderCommentService.insertOneComment(orderComment);
        } catch (Exception e) {
            e.printStackTrace();
        }
        orderCommentService.updaState(6,orderComment.getRepairOrder().getId());

        return "redirect:/user/personalCenter/order/myOrder?userid="+orderComment.getUserinfo().getId();
    }
}
